<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-L-admin1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<div class="x-body layui-anim layui-anim-up">
    <blockquote class="layui-elem-quote">欢迎管理员:
        <span class="x-red" id="username"></span>
    </blockquote>
    <fieldset class="layui-elem-field">
        <legend>数据统计</legend>
        <div class="layui-field-box">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div class="layui-carousel x-admin-carousel x-admin-backlog" lay-anim="" lay-indicator="inside"
                             lay-arrow="none" style="width: 100%; height: 90px;">
                            <div carousel-item="">
                                <ul class="layui-row layui-col-space10 layui-this">
                                    <li class="layui-col-xs2">
                                        <a href="javascript:;" class="x-admin-backlog-body">
                                            <h3>学生数量</h3>
                                            <p>
                                                <cite id="student">66</cite></p>
                                        </a>
                                    </li>
                                    <li class="layui-col-xs2">
                                        <a href="javascript:;" class="x-admin-backlog-body">
                                            <h3>教师数量</h3>
                                            <p>
                                                <cite id="teacher">12</cite></p>
                                        </a>
                                    </li>
                                    <li class="layui-col-xs2">
                                        <a href="javascript:;" class="x-admin-backlog-body">
                                            <h3>管理员数量</h3>
                                            <p>
                                                <cite id="admin">99</cite></p>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </fieldset>
    <fieldset class="layui-elem-field">
        <legend>系统通知</legend>
        <div class="layui-field-box">
            <table class="layui-table" lay-skin="line">
                <tbody>
                <tr>
                    <td>
                        <p>新版L-admin 2.0上线了</p>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p target="_blank">交流qq:(370946531)</p>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </fieldset>
    <fieldset class="layui-elem-field">
        <legend>系统信息</legend>
        <div class="layui-field-box">
            <table class="layui-table">
                <tbody>
                <tr>
                    <th>版本</th>
                    <td>2.0</td>
                </tr>
                <tr>
                    <th>服务器地址</th>
                    <td>#</td>
                </tr>
                <tr>
                    <th>操作系统</th>
                    <td>WIN10</td>
                </tr>
                <tr>
                    <th>编程语言</th>
                    <td>Java</td>
                </tr>
                <tr>
                    <th>JDK版本</th>
                    <td>1.8</td>
                </tr>
                <tr>
                    <th>MYSQL版本</th>
                    <td>8.0.26</td>
                </tr>
                </tbody>
            </table>
        </div>
    </fieldset>
    <fieldset class="layui-elem-field">
        <legend>开发团队</legend>
        <div class="layui-field-box">
            <table class="layui-table">
                <tbody>
                <tr>
                    <th>版权所有</th>
                    <td>
                        <a class='x-a' target="_blank">访问官网</a></td>
                </tr>
                <tr>
                    <th></th>
                    <td></td>
                </tr>
                </tbody>
            </table>
        </div>
    </fieldset>
    <blockquote class="layui-elem-quote layui-quote-nm">感谢layui,Spring,百度,jquery等,为本系统提供技术支持。</blockquote>
</div>
<script>
    $(function () {
        $.ajax({
            type: "post",
            url: "http://localhost:8080/user/getCurrentUser",
            success: function (result) {
                if (result.code == '200' && result.object.priority == '2') {
                    let str = "<span class=\"x-red\" id=\"username\">" + result.object.username + "</span>";
                    $("#username").html(str);
                } else {
                    alert("请先登录账号！");
                    window.location.href = "../../templates/login.html";
                }
            }
        });
    });

    //用户数量
    $(function () {
        for (let i = 0; i < 3; i++) {
            let data = {"priority": i};
            $.post('http://localhost:8080/user/countUser', data, function (result) {
                if (result.code == '200') {
                    if (i == 0) {
                        $("#student").html("<cite id=\"student\">" + result.object + "</cite>");
                    } else if (i == 1) {
                        $("#teacher").html("<cite id=\"teacher\">" + result.object + "</cite>");
                    } else {
                        $("#admin").html("<cite id=\"admin\">" + result.object + "</cite>");
                    }
                }
            });
        }
    });
</script>
</body>
</html>